function fval = int_surplus(Z_K, K_tilde_K, B, a_b, a_s, EPS_L_BOUND, EPS_H_BOUND, S_PARAM, M_PARAM, THETA, DELTA, CHI_q, CHI_PI, CHI_PI_k, CHI_k, tau_k)

sig = S_PARAM;
mu  = M_PARAM;
f   = @(x, a) 1 ./ (x * sig * sqrt(2 * 3.14159265359))...
    .* exp(- (log(x) - mu - a).^2 / 2 / sig^2)...
    .* (x >= EPS_L_BOUND) .* (x <= EPS_H_BOUND);
int_method = 'auto';
Rel_Tol    = 1e-5;
Abs_Tol    = 1e-6;


fun.l_bound      = @(a) EPS_L_BOUND; % lower bound
fun.h_bound      = @(a) EPS_H_BOUND; % upper bound
fun.Delta        = @(y, x, B, CHI_q, CHI_PI) max(0.000001, (1 - tau_k) .* B .* ((1 - THETA - CHI_PI) .* x + THETA .* y) + (1 - DELTA) .* (1 - CHI_q));

% fun.surplus_buy =  @(y, x, a_sell, a_buy, B, CHI_q, CHI_PI, L) (1 - tau_k) .* B .* (x - y) .* f(y, a_sell) .* f(x, a_buy)...
%     .* min((L .* (1 - tau_k) .* B + (1 - tau_k) .* CHI_PI_k .* B .* x +  (1 - DELTA) .* (1 - CHI_q)) ./ fun.Delta(y, x, B, CHI_q, CHI_PI), 1);

fun.surplus_buy =  @(y, x, a_sell, a_buy, B, CHI_q, CHI_PI, CHI_PI_k, CHI_k, Z_K, K_tilde_K) (1 - tau_k) .* B .* (x - y) .* f(y, a_sell) .* f(x, a_buy)...
    .* min((Z_K + CHI_k .* (1 - DELTA) + CHI_PI_k .* (1 - tau_k) .* B .* x) ./ fun.Delta(y, x, B, CHI_q, CHI_PI), K_tilde_K);

fval  = integral2(@(eps_t, eps)fun.surplus_buy(eps_t, eps, a_s, a_b, B, CHI_q, CHI_PI, CHI_PI_k, CHI_k, Z_K, K_tilde_K),...
                    fun.l_bound(a_s),  fun.h_bound(a_s), @(eps_t)eps_t, fun.h_bound(a_b),...
                    'method',int_method, 'RelTol', Rel_Tol, 'AbsTol', Abs_Tol);

end